<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <title>v-for，遍历对象和对象数组</title>
</head>
<body>
    <!-- v-for -->
    <div id="app"> 
       {{msg}}<br/>
       <ul>
           <li v-for="(name,index) in names">
             {{index+1}}----{{name}}
           </li>
       </ul>
       <hr/>
       <ul>
           <!-- 遍历对象绑定一个唯一的属性作为key，底层有状态维护 -->
           <li v-for="(student,index) in students" :key="student.sid">
              {{index+1}}--{{student.sid}}--{{student.sname}}--{{student.age}}
           </li>
       </ul>
    </div>

    <script>
        var vue= new  Vue({
            
            el:"#app",
            data:{
                msg:"",
                names:['zs','ls','ww'],
                students:[
                    {
                    sid:'s01',
                    sname:'时尚',
                    age:13
                },
                {
                    sid:'s02',
                    sname:'的时代',
                    age:34
                }
                ]
            },
            methods:{
               
            }
        })
    </script>
</body>
</html>